package cn.edu.hit.core.combine;

import cn.edu.hit.core.MappedLoader;
import cn.edu.hit.core.Pair;

import java.util.Map;

public final class CombineLoader extends MappedLoader<String, Map, Map, Pair<Long, Map>, CombineAdapter> {
    /**
     * 初始化 SPI
     */
    private CombineLoader() {
        super(CombineAdapter.class);
    }

    private static CombineLoader ourInstance = null;

    public static CombineLoader getInstance() {
        if (ourInstance == null) {
            synchronized (CombineLoader.class) {
                if (ourInstance == null) {
                    ourInstance = new CombineLoader();
                }
            }
        }
        return ourInstance;
    }

    protected CombineAdapter defaultAdapter() {
        return this.adapters.stream().filter(x -> x.accept("FlatMap")).findAny().get();
    }

}
